#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
using namespace std;

class Solution {
public:
    int subarraySum(vector<int>& nums, int k) {
        unordered_map<int, int> hash;
        hash[0] = 1;
        int tmp = 0;
        int sum = 0;
        int n = nums.size();
        for (int i = 0; i < n; i++)
        {
            tmp += nums[i];
            if (hash.find(tmp - k) != hash.end())
            {
                sum += hash[tmp - k];
            }
            hash[tmp]++;
        }

        return sum;
    }
};

int main() {
    return 0;
}